package com.itheima.ai.entity.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.MessageType;

@NoArgsConstructor
@Data
public class MessageVO {

    private String role;

    private String content;

    public MessageVO(Message message) {
        MessageType messageType = message.getMessageType();
        switch (messageType) {
            case USER:
                role = "USER";
                break;
            case ASSISTANT:
                role = "ASSISTANT";
                break;
            default:
                role = "";
                break;
        }
        this.content = message.getText();
    }
}
